<?
session_start();
if(!isset($_SESSION['idUser']))
	exit();

require("includes/constants.php");
require("includes/selectLanguage.php");
require("includes/funciones.inc.php");


$DB = NewADOConnection('mysqlt');
$DB->Connect();
$DB->Execute("SET NAMES utf8;");
//$DB->debug=true;

$strSQL = "SELECT resultValues FROM measurement_item WHERE idMeasurementItem = " . $_REQUEST["idMeasurementItem"];
$rsMeasurement = $DB->Execute($strSQL);

if(!$rsMeasurement->EOF) {
	$objResponse = json_decode($rsMeasurement->fields('resultValues'));
}

?>

<div class="formsPop">
	<form id="measurementResponsePopForm" name="measurementResponsePopForm" method="post">
		<table id="inPopUpM">
			<tbody>
				<tr>
					<td><?=$a_languages['Measurement.Response.WorkIntensity']?></td>
					<td>
						<?php
						echo '<span class="result">';
						if(property_exists($objResponse, 'WorkIntensity'))
							echo $objResponse->WorkIntensity;
						echo '</span>';
						?>
						</span>
					</td>
				</tr>
				<tr>
					<td><?=$a_languages['Measurement.Response.AerobicRecovery']?></td>
					<td>
						<?php 
							echo '<span class="result">';
							if(property_exists($objResponse, 'AerobicRecovery')) {
								echo $objResponse->AerobicRecovery;
								echo '</span>';
								if(property_exists($objResponse, 'AerobicRecovery_Recommendation') && $objResponse->AerobicRecovery_Recommendation != "")
									echo '<span class="result">'.$a_languages['Measurement.Response.Recommendation'].htmlentities(utf8_decode($objResponse->AerobicRecovery_Recommendation), ENT_QUOTES | ENT_IGNORE, "ISO-8859-1")."</span>";
							}
							else 
								echo '</span>';
						?>
						</span>
					</td>
				</tr>
				<tr>
					<td><?=$a_languages['Measurement.Response.MuscularEffort']?></td>
					<td>
						<?php
							echo '<span class="result">';
							if(property_exists($objResponse, 'MuscularEffort')) {
								echo $objResponse->MuscularEffort;
							}
							echo '</span>';
						?>
					</td>
				</tr>
				<tr>
					<td><?=$a_languages['Measurement.Response.MuscleRecovery']?></td>
					<td>
						<?php 
							echo '<span class="result">';
							if(property_exists($objResponse, 'MuscleRecovery')) {
								echo $objResponse->MuscleRecovery;
							}
							echo '</span>';
						?>
					</td>
				</tr>
				<tr>
					<td><?=$a_languages['Measurement.Response.OxygenInput']?></td>
					<td>
						<?php
							echo '<span class="result">';
							if(property_exists($objResponse, 'OxygenInput')) {
								echo $objResponse->OxygenInput;
								echo '</span>';
								if(property_exists($objResponse, 'OxygenInput_Recomedation') && $objResponse->OxygenInput_Recomedation != "")
									echo '<span class="result">'.$a_languages['Measurement.Response.Recommendation'].htmlentities(utf8_decode($objResponse->OxygenInput_Recomedation), ENT_QUOTES | ENT_IGNORE, "ISO-8859-1")."</span>";
							}
							else 
								echo '</span>';
						?>
					</td>
				</tr>
				<tr>
					<td><?=$a_languages['Measurement.Response.HighRiskEnzymes']?></td>
					<td>
						<?php
							echo '<span class="result">';
							if(property_exists($objResponse, 'HighRiskEnzymes')) {
								echo $objResponse->HighRiskEnzymes;
								echo '</span>';
								if(property_exists($objResponse, 'HighRiskEnzymes_Recommendation') && $objResponse->HighRiskEnzymes_Recommendation != "")
									echo '<span class="result">'.$a_languages['Measurement.Response.Recommendation'].htmlentities(utf8_decode($objResponse->HighRiskEnzymes_Recommendation), ENT_QUOTES | ENT_IGNORE, "ISO-8859-1").'</span>';
							}
							else
								echo '</span>';
						?>
					</td>
				</tr>
				<tr>
					<td><?=$a_languages['Measurement.Response.BleedingRisk']?></td>
					<td>
						<?php 
							echo '<span class="result">';
							if(property_exists($objResponse, 'BleedingRisk')) {
								echo $objResponse->BleedingRisk;
								echo '</span>';
								if(property_exists($objResponse, 'BleedingRisk_Recommendation') && $objResponse->BleedingRisk_Recommendation != "") 
									echo '<span class="result">'.$a_languages['Measurement.Response.Recommendation'].htmlentities(utf8_decode($objResponse->BleedingRisk_Recommendation), ENT_QUOTES | ENT_IGNORE, "ISO-8859-1").'</span>';
							}
							else
								echo '</span>';
						?>
					</td>
				</tr>
				<tr>
					<td><?=$a_languages['Measurement.Response.RespiratoryCompromise']?></td>
					<td>
						<?php
							echo '<span class="result">';
							if(property_exists($objResponse, 'RespiratoryCompromise')) {
								echo $objResponse->RespiratoryCompromise;
							}
							echo '</span>';
						?>
					</td>
				</tr>
			</tbody>
		</table>
		<div class="botonesActions">
			<a id="btnExitResult"><?=$a_languages['Common.Close']?></a>
		</div>
	</form>
</div>

<script>
	$(document).ready(function() {
		$('#btnExitResult').click( function(e) {
			$('#measurementResultDialog').dialog('close');
		});
	});
</script>